package io.renren.modules.address_list.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.address_list.entity.V9AddressListEntity;
import io.renren.modules.address_list.service.V9AddressListService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 地址管理
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-10-08 09:55:56
 */
@RestController
@RequestMapping("address_list/v9addresslist")
public class V9AddressListController {
    @Autowired
    private V9AddressListService v9AddressListService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("address_list:v9addresslist:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = v9AddressListService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("address_list:v9addresslist:info")
    public R info(@PathVariable("id") Integer id){
		V9AddressListEntity v9AddressList = v9AddressListService.getById(id);

        return R.ok().put("v9AddressList", v9AddressList);
    }
    @RequestMapping("/info2/{id}")
    public R info2(@PathVariable("id") Integer id){
		V9AddressListEntity v9AddressList = v9AddressListService.getById(id);

        return R.ok().put("v9AddressList", v9AddressList);
    }
    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("address_list:v9addresslist:save")
    public R save(@RequestBody V9AddressListEntity v9AddressList){
		v9AddressListService.save(v9AddressList);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("address_list:v9addresslist:update")
    public R update(@RequestBody V9AddressListEntity v9AddressList){
		v9AddressListService.updateById(v9AddressList);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("address_list:v9addresslist:delete")
    public R delete(@RequestBody Integer[] ids){
		v9AddressListService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }





}
